package beans;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.beans.VetoableChangeListener;
import java.beans.VetoableChangeSupport;
import java.io.Serializable;
import java.util.Collection;

public class Role implements Serializable {

	private static final long serialVersionUID = 4733859236171689941L;

	private int idRole;
	private String libelle;
	private Collection<Enseignant> listeEnseignants;

	PropertyChangeSupport changeSupport;
	VetoableChangeSupport vetoableSupport;
	
	public Role() {}
	
	public Role(int idRole, String libelle) {
		super();
		this.idRole = idRole;
		this.libelle = libelle;
		this.listeEnseignants = null;
	}

	public Collection<Enseignant> getListeEnseignants() {
		return listeEnseignants;
	}

	public void setListeEnseignants(Collection<Enseignant> listeEnseignants) {
		this.listeEnseignants = listeEnseignants;
	}

	public int getIdRole() {
		return idRole;
	}
	
	public void setIdRole(int idRole) {
		this.idRole = idRole;
	}
	
	public String getLibelle() {
		return libelle;
	}
	
	public void setLibelle(String libelle) {
		this.libelle = libelle;
	}
	
	public synchronized void addPropertyChangeListener(PropertyChangeListener listener) {
		changeSupport.addPropertyChangeListener(listener);
	}
	
	public synchronized void removePropertyChangeListener(PropertyChangeListener listener) {
		changeSupport.removePropertyChangeListener(listener);
	}
	
	public synchronized void addVetoableChangeListener(VetoableChangeListener listener) {
		vetoableSupport.addVetoableChangeListener(listener);
	}
	
	public synchronized void removeVetoableChangeListener(VetoableChangeListener listener) {
		vetoableSupport.removeVetoableChangeListener(listener);
	} 
}
